package com.bjsxt.lambda2;

public interface MyInterface4 {
    public int method(int num);

    //public int method2(int num);

    public static void main(String[] args) {
        //情况1：
        MyInterface4 myInterface = (n)->{return n+100;};
        System.out.println(myInterface.method(100));

        //情况2：如果只有一条语句，{}如果省略，必须同时省略return
        MyInterface4 myInterface2 = (n)->n+100;;
        System.out.println(myInterface2.method(100));

        //情况3：如果只有多条语句，{}不可以省略
        MyInterface4 myInterface3 = (n)->{
            System.out.println("-----有参数有返回值--------");
            return  n+100;
        };
        System.out.println(myInterface2.method(100));
    }
}
